import { PureComponent } from 'react'
import { Input, Button} from 'antd'
import SingleTable from 'components/table/index'
import SupplierModal from 'components/modal/supplierModal'
import styles from './supplierManagement.less'
export default class SupplierManagement extends PureComponent {
    state = {
        visible: false
    }
    renderModal(){
        const { visible } = this.state
        return(
            <SupplierModal 
                visible={visible}
                onOk={this.handleOk}
                onCancel={this.handleCancel}
            />
        )
    }
    handleCancel = () => {
        this.setState({ visible: false })
    }
    handleOk = () => {
        this.setState({ visible: false })
    }
    handleAdd = () => {
        this.setState({ visible: true })
    }
    render(){
        const columns = [
            {
                key: 'gmtCreate',
                title: '供应商',
                dataIndex: 'gmtCreate',
                align: 'center',
            },
            {
                key: 'operationTypeName',
                title: '成本项',
                dataIndex: 'operationTypeName',
                align: 'center',
            },
            {
                key: '20',
                title: '银行账户',
                dataIndex: 'operationTypeName',
                align: 'center',
            },
            {
                key: 'creatorName',
                title: '电话',
                dataIndex: 'creatorName',
                align: 'center',
            },
            {
                key: '4',
                title: '创建时间',
                dataIndex: 'creatorName',
                align: 'center',
            },
            {
              key: '5',
              title: '操作',
              dataIndex: 'creatorName',
              align: 'center',
            },
          ]
          const dataList = []
        return(
            <div className={styles.supplierManagement}>
                <div className={styles.supplierManagementBox}>
                    <h2>供应商管理</h2>
                </div>
                <div className={styles.supplierManagementSearch}>
                    <div className={styles.supplierManagementSin}>
                        <span className={styles.supplierManagementSpan}>供应商：</span>
                        <Input className={styles.supplierManagementInput} />
                    </div>
                </div>
                <Button type="primary" icon="search" style={{margin: '0 0 24px 24px'}}>查询</Button>
                <Button  icon="plus" style={{marginLeft: '24px'}} onClick={this.handleAdd}>新增供应商</Button>
                <div className={styles.supplierManagementTable}>
                    <SingleTable
                        data={{ list: dataList }}
                        columns={columns}
                    />
                </div>
                {this.renderModal()}
            </div>
        )
    }
}